Skip to content

Fix bytewise parameter write acknowledgements - #14662

Merged
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
ikalnytskyi:bug/param-ack
Jul 25, 2026
Merged

Fix bytewise parameter write acknowledgements#14662
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
ikalnytskyi:bug/param-ack

Conversation

@ikalnytskyi

@ikalnytskyi ikalnytskyi commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Description

Note

This fixes a regression introduced between Stable_V5.0 and Daily, where Daily unintentionally dropped support for MAVLink parameters of type MAV_PARAM_TYPE_UINT8 and MAV_PARAM_TYPE_UINT16.

When QGC writes a parameter, it waits for the vehicle to echo the new value in PARAM_VALUE. The acknowledgement is accepted only when both the value and the QVariant type match QGC's stored Fact value.

For 8- & 16-bit parameters, FactMetaData stores the value in a QVariant: Qt Int (32-bit) for signed values and 32-bit Qt UInt (32-bit) for unsigned values. This preserves the parameter's signedness in QGC's internal representation.

The _mavlinkParamUnionToVariant method passed uint8_t and uint16_t directly to QVariant. C++ selected QVariant's int constructor, so an unsigned PARAM_VALUE was decoded as signed Qt Int. The type check then rejected the otherwise valid acknowledgement and the write timed out. Decode narrow values into QGC's canonical Int or UInt representations.

The bug affects only UINT8 and UINT16 parameters; the other supported types coincidentally work. It flew below the radar because ArduPilot uses float-based parameter encoding, while PX4 does not expose UINT8 or UINT16 parameters for which the problem exhibits itself.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/Build changes
  • Other

Testing

  • Tested locally
  • Added/updated unit tests
  • Tested with simulator (SITL)
  • Tested with hardware

Platforms Tested

  • Linux
  • Windows
  • macOS
  • Android
  • iOS

Flight Stacks Tested

  • PX4
  • ArduPilot
  • Generic

Screenshots

Checklist

  • I have read the Contribution Guidelines
  • I have read the Code of Conduct
  • My code follows the project's coding standards
  • I have added tests that prove my fix/feature works
  • New and existing unit tests pass locally

Related Issues


By submitting this pull request, I confirm that my contribution is made under the terms of the project's dual license (Apache 2.0 and GPL v3).

Copilot AI review requested due to automatic review settings July 20, 2026 21:39
@ikalnytskyi
ikalnytskyi requested a review from HTRamsey as a code owner July 20, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes parameter write acknowledgements for bytewise MAVLink parameter types by decoding MAV_PARAM_TYPE_UINT8/UINT16 (and similarly INT8/INT16) into QGC’s canonical 32-bit QVariant integer representations, preventing valid PARAM_VALUE echoes from being rejected due to mismatched QVariant types.

Changes:

  • Fix _mavlinkParamUnionToVariant to cast narrow integer types to qint32/quint32 before wrapping in QVariant.
  • Add unit tests covering successful writes of UINT8 and UINT16 parameters.
  • Extend MockLink to load a minimal generic parameter set containing UINT8/UINT16 test parameters.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/FactSystem/ParameterManagerTest.h Adds new unit test slots and extends the helper signature to parameterize param name and autopilot type.
test/FactSystem/ParameterManagerTest.cc Implements UINT8/UINT16 write tests and updates the helper to support generic autopilot + integer step sizing.
src/FactSystem/ParameterManager.cc Fixes UINT8/UINT16 (and INT8/INT16) decoding to consistent 32-bit QVariant integer types.
src/Comms/MockLink/MockLink.cc Loads a new generic parameter file when MAV_AUTOPILOT_GENERIC is used.
src/Comms/MockLink/GenericMockLink.params Adds test parameters TEST_UINT8 and TEST_UINT16 with MAVLink types for coverage.
src/Comms/MockLink/CMakeLists.txt Registers GenericMockLink.params as a Qt resource for the mock link.

return true;
case MAV_PARAM_TYPE_UINT8:
outValue = QVariant(paramUnion.param_uint8);
outValue = QVariant(static_cast<quint32>(paramUnion.param_uint8));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n.b. Without this cast, QVariant ends up storing an int, not a uint, while the fact system we compare this value to stores a uint. Due to the mismatch, QGC rejects write acknowledgement, retries and eventually shows the write failure.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 32.55%. Comparing base (f29efd3) to head (93a7608).
⚠️ Report is 195 commits behind head on master.

Files with missing lines Patch % Lines
src/Comms/MockLink/MockLink.cc 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14662      +/-   ##
==========================================
+ Coverage   25.47%   32.55%   +7.08%     
==========================================
  Files         769      782      +13     
  Lines       65912    67259    +1347     
  Branches    30495    31164     +669     
==========================================
+ Hits        16788    21897    +5109     
+ Misses      37285    30608    -6677     
- Partials    11839    14754    +2915     
Flag Coverage Δ
unittests 32.55% <83.33%> (+7.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/FactSystem/ParameterManager.cc 41.71% <100.00%> (+4.91%) ⬆️
src/Comms/MockLink/MockLink.cc 57.34% <50.00%> (+6.46%) ⬆️

... and 472 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da14fad...93a7608. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Build Results

Platform Status

Platform Status Details
Linux Passed View
Windows Passed View
MacOS Passed View
Android Passed View

All builds passed.

Pre-commit

Check Status Details
pre-commit Failed (non-blocking) View

Pre-commit hooks: 0 passed, 0 failed, 0 skipped.

Test Results

linux-coverage-integration: 36 passed, 0 skipped
linux-coverage-unit: 114 passed, 0 skipped
Total: 150 passed, 0 skipped

Code Coverage

Coverage: 69.2%

No baseline available for comparison

Artifact Sizes

Artifact Size
QGroundControl 221.83 MB
QGroundControl-aarch64 179.34 MB
QGroundControl-installer-AMD64 137.85 MB
QGroundControl-installer-AMD64-ARM64 80.36 MB
QGroundControl-installer-ARM64 109.12 MB
QGroundControl-linux 87.01 MB
QGroundControl-mac 87.00 MB
QGroundControl-windows 86.06 MB
QGroundControl-x86_64 191.57 MB
No baseline available for comparison

Updated: 2026-07-25 13:49:04 UTC • Commit: 93a7608 • Triggered by: Android

Copilot AI review requested due to automatic review settings July 21, 2026 08:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread test/FactSystem/ParameterManagerTest.cc
Copilot AI review requested due to automatic review settings July 21, 2026 09:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/Comms/MockLink/MockLink.cc
Copilot AI review requested due to automatic review settings July 22, 2026 13:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@DonLakeFlyer

Copy link
Copy Markdown
Contributor

Fantastic stuff. Thanks for the fix.

Can you rebase to latest upstream master? This should fix the CI failure. Just want to make sure.

@DonLakeFlyer DonLakeFlyer added this to the Release V5.1 milestone Jul 25, 2026
When QGC writes a parameter, it waits for the vehicle to echo the new
value in PARAM_VALUE. The acknowledgement is accepted only when both the
value and the QVariant type match QGC's stored Fact value.

For 8- & 16-bit parameters, FactMetaData stores the value in a QVariant:
Qt Int (32-bit) for signed values and 32-bit Qt UInt (32-bit) for
unsigned values. This preserves the parameter's signedness in QGC's
internal representation.

The `_mavlinkParamUnionToVariant` method passed `uint8_t` and `uint16_t`
directly to QVariant. C++ selected QVariant's `int` constructor, so an
unsigned PARAM_VALUE was decoded as signed Qt Int. The type check then
rejected the otherwise valid acknowledgement and the write timed out.
Decode narrow values into QGC's canonical Int or UInt representations.

The bug affects only UINT8 and UINT16 parameters; the other supported
types coincidentally work. It flew below the radar because ArduPilot
uses float-based parameter encoding, while PX4 does not expose UINT8 or
UINT16 parameters for which the problem exhibits itself.
Copilot AI review requested due to automatic review settings July 25, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@ikalnytskyi

Copy link
Copy Markdown
Contributor Author

@DonLakeFlyer Just rebased and CI is green now 👍

@DonLakeFlyer
DonLakeFlyer merged commit 83fb003 into mavlink:master Jul 25, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants